﻿<UserControl x:Class="ScrumFactory.Backlog.Backlog"             
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"             
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             xmlns:props="clr-namespace:ScrumFactory.Backlog.Properties"
             
             xmlns:SF_Comp="clr-namespace:ScrumFactory.Composition;assembly=ScrumFactory.Composition"                             
             xmlns:SF_VM="clr-namespace:ScrumFactory.Backlog.ViewModel;assembly=ScrumFactory.Backlog"
             xmlns:SF="clr-namespace:ScrumFactory;assembly=ScrumFactory"   
             
             xmlns:SF_Helpers="clr-namespace:ScrumFactory.Windows.Helpers;assembly=ScrumFactory.Windows.Helpers"
             xmlns:SF_Helpers_Ext="clr-namespace:ScrumFactory.Windows.Helpers.Extensions;assembly=ScrumFactory.Windows.Helpers"
             xmlns:SF_DD="clr-namespace:ScrumFactory.Windows.Helpers.DragDrop;assembly=ScrumFactory.Windows.Helpers"
             
             x:Name="thisView"
             
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="600">
    
    <UserControl.InputBindings>
        <KeyBinding Key="Enter" Command="{Binding CreateNewBacklogItemCommand}"/>
    </UserControl.InputBindings>
    
    <UserControl.Resources>
        
        <DataTemplate x:Key="BacklogItemDragDataTemplate">
            <Image  DataContext="{Binding Item.Status}" Style="{StaticResource BacklogItemStatusImage}" Width="20" Height="20" Stretch="Uniform" />
        </DataTemplate>
        
        <Style x:Key="CurrentSprintTextBlock" TargetType="TextBlock">            
            <Style.Triggers>
                <DataTrigger Binding="{Binding IsAtCurrentSprint}" Value="True">
                    <Setter Property="TextBlock.FontWeight" Value="SemiBold"/>
                </DataTrigger>
            </Style.Triggers>            
        </Style>
        
        <Style x:Key="StatusFilterImage" TargetType="{x:Type Image}">
            <Setter Property="Width" Value="32"/>
            <Setter Property="Height" Value="32"/>
            <Setter Property="Stretch" Value="Uniform"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding .}" Value="0">
                    <Setter Property="Source" Value="/Images/ToolBar/todo_backlog.png"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding .}" Value="1">
                    <Setter Property="Source" Value="/Images/ToolBar/planning_backlog.png"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding}" Value="2">
                    <Setter Property="Image.Source" Value="/Images/ToolBar/selected_backlog.png"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding}" Value="3">
                    <Setter Property="Image.Source" Value="/Images/ToolBar/all_backlog.png"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>
        
        <Style x:Key="DueDateTextBlock" TargetType="{x:Type TextBlock}">            
            <Setter Property="HorizontalAlignment" Value="Left"/>
            <Style.Triggers>                
                <DataTrigger Binding="{Binding IsAtCurrentSprint}" Value="True">
                    <Setter Property="TextBlock.FontWeight" Value="SemiBold"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding IsPlanningLate}" Value="True">
                    <Setter Property="TextBlock.Foreground" Value="{StaticResource AlertBrush}"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding Item.SprintNumber}" Value="{x:Null}">
                    <Setter Property="TextBlock.Text" Value="plan"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="DueDateMenu" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource DueDateTextBlock}">            
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="TextDecorations" Value="Underline"/>
                </Trigger>                
            </Style.Triggers>
        </Style>

        <ObjectDataProvider  x:Key="backlogFilterList" MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="SF_VM:BacklogStatusFilter"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
        
        <DataTemplate x:Key="BacklogStatusFilterDataTemplate">
            <StackPanel Orientation="Vertical">
                <Image Style="{StaticResource StatusFilterImage}"/>                
                <TextBlock FontSize="{StaticResource SmallFontSize}"
                           TextTrimming="CharacterEllipsis"
                           HorizontalAlignment="Center"
                           Foreground="{StaticResource ToolBarItemBrush}"
                           Text="{Binding ., Converter={StaticResource LocalizeConverter}, ConverterParameter='ScrumFactory.Backlog.Backlog,ScrumFactory.Backlog'}"/>
            </StackPanel>            
        </DataTemplate>

        <DataTemplate x:Key="BacklogStatusFilterDropDownDataTemplate">
            <StackPanel Orientation="Horizontal">                
                <Image Style="{StaticResource StatusFilterImage}" Margin="0,0,5,0"/>
                <TextBlock>
                    <Run Text="{Binding ., Converter={StaticResource LocalizeConverter}, ConverterParameter='ScrumFactory.Backlog.Backlog,ScrumFactory.Backlog'}"/>    
                    <LineBreak/>
                    <Run FontSize="{StaticResource SmallFontSize}" Foreground="{StaticResource SubTextBrush}"                         
                         Text="{Binding ., Converter={StaticResource LocalizeWithTooltipConverter}, ConverterParameter='ScrumFactory.Backlog.Backlog,ScrumFactory.Backlog'}"/>
                </TextBlock>                
            </StackPanel>
        </DataTemplate>

    </UserControl.Resources>

    <SF_Helpers:PanelLayout Title="{Binding PanelName}"
                            SF_Comp:CommandBehavior.RoutedEventName="Loaded"
                            SF_Comp:CommandBehavior.TheCommandToRun="{Binding LoadDataCommand}">

        <!-- TOOLBAR -->
        <SF_Helpers:PanelLayout.Toolbar>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>

                <ToolBar Grid.Column="0" >
                    <Border HorizontalAlignment="Stretch">
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
                            <TextBox x:Name="newItemTextBox"       
                            ToolTip="{x:Static props:Resources.New_item_name}" Width="400"                           
                            Text="{Binding NewItemName, UpdateSourceTrigger=PropertyChanged}"                                                         
                            HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
                            <MenuItem Header="{x:Static props:Resources.New_item}" Command="{Binding CreateNewBacklogItemCommand}">
                                <MenuItem.Icon>
                                    <Image Source="/Images/ToolBar/Add.png" Width="32" Height="32" Stretch="Uniform"/>
                                </MenuItem.Icon>
                            </MenuItem>
                        </StackPanel>
                        <Border.Style>
                            <Style BasedOn="{StaticResource ToolBarInsideBorder}" TargetType="{x:Type Border}">
                                <Setter Property="Border.Visibility" Value="Collapsed"/>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding UserCannotEdit}" Value="false">
                                        <Setter Property="Border.Visibility" Value="Visible"/>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Border.Style>
                    </Border>


                    <Border>
                        <StackPanel Orientation="Horizontal">

                            <StackPanel ToolTip="{x:Static props:Resources.size_left_tooltip}" VerticalAlignment="Center" Margin="5,0,5,0">
                                <TextBlock                        
                        HorizontalAlignment="Center"
                    Foreground="{StaticResource LabelBrush}"
                    FontFamily="{StaticResource WideFont}"
                    FontSize="{StaticResource ReallyBigFontSize}"
                    Text="{Binding ItemsLeftTotalSize, StringFormat='{}{0:0}'}"/>
                                <TextBlock                    
                        HorizontalAlignment="Center"
                        Foreground="{StaticResource LabelBrush}"
                        FontFamily="{StaticResource WideFont}"
                        FontSize="{StaticResource SmallFontSize}"
                        Text="{x:Static props:Resources.pts}"/>
                            </StackPanel>

                            <StackPanel ToolTip="{x:Static props:Resources.hrs_left_tooltip}" VerticalAlignment="Center" Margin="5,0,5,0">
                                <TextBlock                        
                        HorizontalAlignment="Center"
                    Foreground="{StaticResource LabelBrush}"
                    FontFamily="{StaticResource WideFont}"
                    FontSize="{StaticResource ReallyBigFontSize}"
                    Text="{Binding ItemsLeftTotalHours, StringFormat='{}{0:0}'}"/>
                                <TextBlock                    
                        HorizontalAlignment="Center"
                        Foreground="{StaticResource LabelBrush}"
                        FontFamily="{StaticResource WideFont}"
                        FontSize="{StaticResource SmallFontSize}"
                        Text="{x:Static props:Resources.hrs_left}"/>
                            </StackPanel>



                            <StackPanel ToolTip="{x:Static props:Resources.velocity_tooltip}" VerticalAlignment="Center" Margin="5,0,5,0">
                                <TextBlock                        
                        HorizontalAlignment="Center"
                    Foreground="{StaticResource LabelBrush}"
                    FontFamily="{StaticResource WideFont}"
                    FontSize="{StaticResource ReallyBigFontSize}"
                    Text="{Binding RequiredVelocity, StringFormat='{}{0:0.0}'}"/>
                                <TextBlock                    
                        HorizontalAlignment="Center"
                        Foreground="{StaticResource LabelBrush}"
                        FontFamily="{StaticResource WideFont}"
                        FontSize="{StaticResource SmallFontSize}"
                        Text="{x:Static props:Resources.pts_hrs}"/>
                            </StackPanel>



                        </StackPanel>
                    </Border>

                    <MenuItem Header="{x:Static props:Resources.Plan_items}" Command="{Binding PlanAllLateItemsCommand}"
                          Style="{StaticResource Toolbar_MenuItemStyleHideWhenDisabled}">
                        <MenuItem.Icon>
                            <Image Source="/Images/ToolBar/planItems.png" Width="32" Height="32" Stretch="Uniform"/>
                        </MenuItem.Icon>
                    </MenuItem>

                </ToolBar>

                <ToolBar Grid.Column="1">


                    <MenuItem Header="{x:Static props:Resources.Item_sizes}" Command="{Binding EditItemSizesCommand}">
                        <MenuItem.Icon>
                            <Image Source="/Images/ToolBar/Plan.png" Width="32" Height="32" Stretch="Uniform"/>
                        </MenuItem.Icon>
                    </MenuItem>

                    <Border Margin="5,0,0,0">
                        <StackPanel Orientation="Horizontal">
                            <TextBox 
                             ToolTip="{x:Static props:Resources.Search}"                   
                            Width="200"
                            Text="{Binding SearchFilterText, UpdateSourceTrigger=PropertyChanged}"
                            Style="{StaticResource SearchTextBox}"
                             HorizontalAlignment="Center" VerticalAlignment="Center"/>
                            <ComboBox x:Name="itemStatusFilterComboBox"                                                                 
                              Width="80" 
                              Style="{StaticResource CleanComboBox}"                                  
                              SelectedItem="{Binding StatusFilter}"
                              VerticalAlignment="Center"                                                                
                              ItemsSource="{Binding Source={StaticResource backlogFilterList}}">
                                <ComboBox.ItemTemplate>
                                    <DataTemplate>
                                        <ContentControl x:Name="content" Content="{Binding}" ContentTemplate="{StaticResource BacklogStatusFilterDropDownDataTemplate}"/>
                                        <DataTemplate.Triggers>
                                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=ComboBoxItem}}" Value="{x:Null}">
                                                <Setter TargetName="content" Property="ContentTemplate" Value="{StaticResource BacklogStatusFilterDataTemplate}"/>
                                            </DataTrigger>
                                        </DataTemplate.Triggers>
                                    </DataTemplate>
                                </ComboBox.ItemTemplate>

                            </ComboBox>

                            <MenuItem Header="{x:Static props:Resources.Issue_only}" IsCheckable="True" IsChecked="{Binding ShowIssueOnly}">
                                <MenuItem.Icon>
                                    <Image Source="/Images/TaskTypes/bug2.png" Width="24" Height="24" Stretch="Uniform"/>
                                </MenuItem.Icon>
                            </MenuItem>

                        </StackPanel>
                    </Border>



                </ToolBar>
            </Grid>
        </SF_Helpers:PanelLayout.Toolbar>

        <!-- CONTENT -->
        <SF_Helpers:PanelLayout.Content>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="*"/>                    
                </Grid.ColumnDefinitions>

                <Expander Grid.Column="0" Margin="0,0,10,0" ExpandDirection="Right" HorizontalContentAlignment="Right">
                    <ContentPresenter x:Name="groupListView" Content="{Binding GroupList.View}"/>
                </Expander>

                <ListView
                    Grid.Column="1"
                    x:Name="listview"                     
                    SF_Helpers:ListViewColumnsExtension.Stretch="True"
            
                    SF_Helpers:ItemActivation.ActivationMode="Both"            
                    SF_Helpers:ItemActivation.TheCommandToRun="{Binding ShowDetailWindowCommand}"                                                        
                                        
                    SF_DD:DragDropHelper.OnDropCommand="{Binding MoveItemToCommand}"                    
                    SF_DD:DragDropHelper.IsDropTarget="True"
                    SF_DD:DragDropHelper.DragDropTemplate="{StaticResource BacklogItemDragDataTemplate}"
                                
                    ItemsSource="{Binding FilteredBacklog}" 
                    
                    VirtualizingStackPanel.IsVirtualizing="True"
                    
            
                    ScrollViewer.VerticalScrollBarVisibility="Auto"
                    ScrollViewer.HorizontalScrollBarVisibility="Disabled"            
                    VerticalAlignment="Stretch"                        
                    BorderThickness="0">
                    <ListView.GroupStyle>
                        <GroupStyle>
                            <GroupStyle.ContainerStyle>
                                <Style TargetType="{x:Type GroupItem}">
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="{x:Type GroupItem}">
                                                <Grid>
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="Auto"/>
                                                    </Grid.RowDefinitions>
                                                    <StackPanel                                                
                                                HorizontalAlignment="Stretch" Background="Transparent">
                                                        <TextBlock
                                                    Margin="5,3,5,3"
                                                HorizontalAlignment="Stretch"
                                                FontSize="{StaticResource NormalFontSize}" 
                                                Foreground="{StaticResource AlertBrush}"                                                                                                
                                                Text="{x:Static props:Resources.The_following_items_have_not_been_planned_yet}"/>
                                                        <StackPanel.Style>
                                                            <Style>
                                                                <Setter Property="StackPanel.Visibility" Value="Collapsed"/>
                                                                <Style.Triggers>
                                                                    <DataTrigger Binding="{Binding Name}" Value="{x:Null}">
                                                                        <Setter Property="StackPanel.Visibility" Value="Visible"/>
                                                                    </DataTrigger>
                                                                </Style.Triggers>
                                                            </Style>
                                                        </StackPanel.Style>
                                                    </StackPanel>

                                                    <ItemsPresenter Grid.Row="1" />
                                                    <Line Grid.Row="1" X1="0" X2="1" Y1="0" Y2="0" Stretch="Fill" VerticalAlignment="Bottom"
                                                  StrokeDashArray="2" StrokeThickness="3">
                                                        <Line.Style>
                                                            <Style>
                                                                <Setter Property="Line.Stroke" Value="LightGray"/>
                                                                <Style.Triggers>
                                                                    <DataTrigger Binding="{Binding Name}" Value="{x:Null}">
                                                                        <Setter Property="Line.Stroke" Value="{StaticResource AlertBrush}"/>
                                                                    </DataTrigger>
                                                                </Style.Triggers>
                                                            </Style>
                                                        </Line.Style>
                                                    </Line>
                                                    <Grid.Style>
                                                        <Style>
                                                            <Style.Triggers>
                                                                <DataTrigger Binding="{Binding Name}" Value="{x:Null}">
                                                                    <Setter Property="Grid.Background" Value="{StaticResource AlertBackgroundBrush}"/>
                                                                </DataTrigger>
                                                            </Style.Triggers>
                                                        </Style>
                                                    </Grid.Style>
                                                </Grid>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </GroupStyle.ContainerStyle>
                        </GroupStyle>
                    </ListView.GroupStyle>


                    <ListView.View>
                        <GridView>
                            
                            <GridViewColumn Header="{x:Static props:Resources.Status}"  Width="65">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal" Height="26">                                            
                                            <ComboBox         
                                                IsTabStop="False"
                                                Style="{StaticResource CleanComboBox}"
                                                IsReadOnly="{Binding Model.UserCannotEdit, ElementName=thisView}"                                    
                                                SelectedValue="{Binding ItemStatus, Converter={StaticResource EnumToShortConverter}, ConverterParameter={x:Type SF:BacklogItemStatus},UpdateSourceTrigger=PropertyChanged}"                        
                                                Width="26"                                   
                                                SF_Comp:CommandBehavior.RoutedEventName="SelectionChanged"
                                                SF_Comp:CommandBehavior.TheCommandToRun="{Binding ChangeStatusCommand}"
                                                ItemsSource="{Binding Source={StaticResource BacklogItemStatusList}}">
                                                <ComboBox.ItemTemplate>
                                                    <DataTemplate>
                                                        <ContentControl x:Name="content" Content="{Binding}" ContentTemplate="{StaticResource StatusItemDataTemplate}"/>
                                                        <DataTemplate.Triggers>
                                                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=ComboBoxItem}}" Value="{x:Null}">
                                                                <Setter TargetName="content" Property="ContentTemplate" Value="{StaticResource StatusItemShortDataTemplate}"/>
                                                            </DataTrigger>
                                                        </DataTemplate.Triggers>
                                                    </DataTemplate>
                                                </ComboBox.ItemTemplate>
                                            </ComboBox>
                                            
                                            <DockPanel Style="{StaticResource ItemActionMenu}">                                                
                                                <Button Style="{StaticResource CleanButton}" Command="{Binding ShowTasksCommand}">
                                                    <Image Source="/Images/Toolbar/PostItView.png" Width="24" Height="24"/>
                                                </Button>
                                            </DockPanel>
                                        </StackPanel>
                                        
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            
                            <GridViewColumn Header="{x:Static props:Resources.Item}">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Grid>
                                            <TextBlock HorizontalAlignment="Right" VerticalAlignment="Top" Height="16" >
                                                <Image Width="16" Height="16" Style="{StaticResource IssueImage}" DataContext="{Binding Item.IssueType}"/>
                                                <TextBlock Text="{Binding Item.BacklogItemNumber}" Foreground="{StaticResource SubTextBrush}" FontSize="{StaticResource SmallFontSize}" Style="{StaticResource CurrentSprintTextBlock}" VerticalAlignment="Center"/>    
                                            </TextBlock>
                                            <StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="-6,0,0,0">
                                                
                                                <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Center">
                                                    <Hyperlink Command="{Binding Model.ShowDetailWindowCommand, ElementName=thisView}"
                                                               CommandParameter="{Binding .}" >                                                                                                
                                                        <TextBlock Style="{StaticResource CurrentSprintTextBlock}" FontSize="{StaticResource BigFontSize}"  Text="{Binding Item.Name}"/>                                                            
                                                    </Hyperlink>
                                                </TextBlock>
                                                 <TextBlock                                        
                                                     VerticalAlignment="Center"
                                                    Text="{Binding Item.Description}"                                        
                                                    MaxHeight="60"
                                                    TextWrapping="Wrap" TextTrimming="CharacterEllipsis"/>
                                            </StackPanel>
                                            <DockPanel Style="{StaticResource ItemActionMenu}">                              
                                                <Button                                                       
                                                    Style="{StaticResource RemoveActionButton}"                                             
                                                    Command="{Binding ElementName=thisView, Path=DataContext.DeleteBacklogItemCommand}"
                                                    CommandParameter="{Binding .}"/>                                             
                                            </DockPanel>
                                            
                                        </Grid>

                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>

                            
                            <GridViewColumn Header="{x:Static props:Resources.Hours}" Width="140" >
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Grid HorizontalAlignment="Stretch" VerticalAlignment="Center" >
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="auto"/>
                                                <ColumnDefinition Width="*"/>
                                            </Grid.ColumnDefinitions>
                                            
                                            <StackPanel Orientation="Vertical" Width="50" Grid.Column="0">
                                                <TextBlock Text="{Binding Item.CurrentTotalHours, StringFormat='{}0.#'}"                                           
                                                   FontSize="{StaticResource ReallyBigFontSize}"
                                                   FontWeight="Bold"
                                                   HorizontalAlignment="Center"                                           
                                                   Foreground="{StaticResource LabelBrush}"
                                                   ToolTip="{Binding PlannedHoursToolTip}"/>
                                                <TextBlock Text="{x:Static props:Resources.hrs}"
                                                   HorizontalAlignment="Center"
                                                   FontSize="{StaticResource SmallFontSize}" Foreground="{StaticResource LabelBrush}"/>
                                            </StackPanel>
                                            <Border
                                                HorizontalAlignment="Stretch" Height="20" Grid.Column="1" 
                                                ToolTip="{Binding HoursLeft, StringFormat={x:Static props:Resources.N_hours_left}}"
                                                BorderThickness="1" Margin="10,0,20,0">
                                                <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="White">
                                                    <Border.RenderTransformOrigin>
                                                        <Point X="1" Y="0"/>
                                                    </Border.RenderTransformOrigin>
                                                    <Border.RenderTransform>
                                                        <ScaleTransform ScaleX="{Binding PctHoursLeft}" />
                                                    </Border.RenderTransform>                                                    
                                                </Border>
                                                <Border.Style>
                                                    <Style>
                                                        <Setter Property="Border.BorderBrush" Value="{StaticResource ProgressBarBorder}"/>
                                                        <Setter Property="Border.Background" Value="{StaticResource ProgressBarLeftBackground}"/>
                                                        <Style.Triggers>
                                                            <DataTrigger Binding="{Binding IsHoursLeftOverLimit}" Value="1">
                                                                <Setter Property="Border.Background" Value="{StaticResource ProgressBarLeftLimit1Background}"/>
                                                            </DataTrigger>
                                                            <DataTrigger Binding="{Binding IsHoursLeftOverLimit}" Value="2">
                                                                <Setter Property="Border.Background" Value="{StaticResource ProgressBarLeftLimit2Background}"/>
                                                            </DataTrigger>
                                                        </Style.Triggers>                                                                                                                
                                                    </Style>
                                                </Border.Style>
                                            </Border>
                                        </Grid>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            
                            
                            <GridViewColumn Header="{x:Static props:Resources.Due_to}" Width="80">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>

                                        <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" VerticalAlignment="Center">

                                            <TextBlock 
                                                Text="{Binding DeliveryDate, Converter={StaticResource ContextDateConverter}}"
                                                Style="{StaticResource DueDateTextBlock}" />

                                            <Menu>
                                                <MenuItem>
                                                    <MenuItem.Header>
                                                        <TextBlock 
                                                                TextWrapping="Wrap"  
                                                                VerticalAlignment="Center"
                                                                Text="{Binding ItemSprintLabel}"                                                                                                                   
                                                                FontSize="{StaticResource SmallFontSize}"
                                                                TextDecorations="Underline"
                                                                Foreground="{StaticResource LinkBrush}"                                                            
                                                                Style="{StaticResource DueDateMenu}"/>
                                                    </MenuItem.Header>
                                                    <MenuItem.Items>
                                                        <MenuItem Header="{x:Static props:Resources.to_current}" Command="{Binding MoveItemToCurrentSprintCommand}"/>
                                                        <MenuItem Header="{x:Static props:Resources.to_previous}"  Command="{Binding MoveItemToPreviousSprintCommand}" />
                                                        <MenuItem Header="{x:Static props:Resources.to_next}"  Command="{Binding MoveItemToNextSprintCommand}"/>
                                                        <MenuItem Header="{x:Static props:Resources.to_last}" Command="{Binding MoveItemToLastSprintCommand}"/>
                                                    </MenuItem.Items>
                                                </MenuItem>
                                            </Menu>


                                        </StackPanel>



                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                           
                            <GridViewColumn Width="35">                                
                                <GridViewColumn.CellTemplate>                                    
                                    <DataTemplate>
                                        <ComboBox   HorizontalAlignment="Left" VerticalAlignment="Stretch"                                                        
                                                    SF_Comp:CommandBehavior.RoutedEventName="SelectionChanged"
                                                    SF_Comp:CommandBehavior.TheCommandToRun="{Binding ChangeGroupCommand}"                                                    
                                                    ItemsSource="{Binding ElementName=groupListView, Path=Content.Model.Groups}"
                                                    SelectedValue="{Binding Item.GroupUId}" SelectedValuePath="GroupUId" 
                                                    Style="{StaticResource ItemGroupComboBox}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>

                        </GridView>
                    </ListView.View>

                    <ListView.ItemContainerStyle>
                        <Style BasedOn="{StaticResource {x:Type ListViewItem}}" TargetType="{x:Type ListViewItem}">
                            <Setter Property="SF_DD:DragDropHelper.IsDragAllowed" Value="{Binding IsDevelopmentItem}"/>
                        </Style>
                    </ListView.ItemContainerStyle>
                    
                    <ListView.Style>
                        <Style BasedOn="{StaticResource {x:Type ListView}}" TargetType="{x:Type ListView}">
                            <Setter Property="SF_DD:DragDropHelper.IsDragSource" Value="True"/>
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding Model.UserCannotEdit, ElementName=thisView}" Value="True">
                                    <Setter Property="SF_DD:DragDropHelper.IsDragSource" Value="False"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </ListView.Style>


                </ListView>

                <Grid
                    Grid.Column="1"
            HorizontalAlignment="Center"
            VerticalAlignment="Center">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Image Grid.Column="0" Source="/Images/information.png" Margin="3" VerticalAlignment="Top" Width="16" Height="16" Stretch="Uniform" />
                    <TextBlock Grid.Column="1" TextWrapping="Wrap" >
                <TextBlock TextWrapping="Wrap" Text="{x:Static props:Resources.No_items_were_found}"/><LineBreak/>
                <TextBlock TextWrapping="Wrap"                            
                           Margin="0,10,0,0" Foreground="{StaticResource SubTextBrush}" Text="{x:Static props:Resources.No_items_were_found_tip}"/>
            </TextBlock>
                    <Grid.Style>
                        <Style>
                            <Setter Property="Grid.Visibility" Value="Collapsed"/>
                            <Style.Triggers>
                                <MultiDataTrigger>
                                    <MultiDataTrigger.Conditions>
                                        <Condition Binding="{Binding ElementName=listview, Path=HasItems}" Value="False"/>
                                        <Condition Binding="{Binding IsLoadingData}" Value="False"/>
                                    </MultiDataTrigger.Conditions>
                                    <Setter Property="Grid.Visibility" Value="Visible"/>
                                </MultiDataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Grid.Style>
                </Grid>

                <ContentControl                  
                            Grid.Column="1"                                                
                            Style="{StaticResource LoadingAnimationContent}"/>


                


            </Grid>
        </SF_Helpers:PanelLayout.Content>
        
    </SF_Helpers:PanelLayout>
</UserControl>
